Predictive model evaluation and training based on utility

ABSTRACT

Methods, systems, and apparatus, including computer programs encoded on a computer storage medium, for training a plurality of different types of predictive models using training data, wherein each of the predictive models implements a different machine learning technique. One or more weights are obtained wherein each weight is associated with an answer category in the plurality of examples. A weighted accuracy is calculated for each of the predictive models using the one or more weights.

CROSS-REFERENCE TO RELATED APPLICATIONS

Under 35 U.S.C. §119, this application claims benefit of U.S.Provisional Application Ser. No. 61/499,629, filed Jun. 21, 2011, theentire contents of which are hereby incorporated by reference.

BACKGROUND

This specification generally relates to training and evaluatingpredictive models.

Predictive modeling generally refers to techniques for extractinginformation from data to build a predictive model (or “model”) that canpredict an output from a given input. Predicting an output can includepredicting future trends or behavior patterns, or performing sentimentanalysis, to name a few examples. Various types of predictive models canbe used to analyze data and generate predictive outputs. Examples ofpredictive models include Naive Bayes classifiers, k-nearest neighborclassifiers, support vector machines, and logistic regressiontechniques, for example. Typically, a predictive model is trained withtraining data that includes input data and the desired predictiveoutput. The amount of training data that may be required to train apredictive model can be large, e.g., in the order of gigabytes orterabytes. The number of different types of predictive models availableis extensive, and different models behave differently depending on thetype of input data.

SUMMARY

The value of making a decision given the prediction of an algorithm candepend on the true outcome and the decision to be made. For instance,the value of accepting a loan application when the loan will be paidback in full is roughly the amount of interest the loan will bring in;the cost of accepting a loan that will not be paid back is the amount ofmoney not paid back; the (opportunity) cost of rejecting a loan thatwill be paid back is the amount of the loan. When predictive models areevaluated based solely on their accuracy, this “utility” is lost. Invarious implementations, a predictive model can be evaluated and trainedwith an eye towards maximizing the utility of the model. Weights orfunctions can applied to predictive model outputs for different types ofmodel input in order to determine which models perform best. A utilityfunction can be used to guide the training of models.

In general, one aspect of the subject matter described in thisspecification can be embodied in methods that include the actions ofobtaining training data comprising a plurality of examples wherein eachexample comprises one or more features and an answer; training aplurality of different types of predictive models using the trainingdata, wherein each of the predictive models implements a differentmachine learning technique; obtaining one or more weights wherein eachweight is associated with an answer category in the plurality ofexamples; calculating a weighted accuracy for each of the predictivemodels using the one or more weights; and selecting one of thepredictive models as a most accurate model based at least partly on thecalculated weighted accuracies. Other embodiments of this aspect includecorresponding systems, apparatus, and computer programs.

These and other aspects can optionally include one or more of thefollowing features. A plurality of the weighted accuracies arecalculated in parallel. A particular answer category is a label, anumeric value, a range of numeric values, or a set of numeric values.Calculating the weighted accuracy for a particular predictive modelcomprises: performing a plurality of rounds of cross-validation of thepredictive model using the training data wherein each round ofcross-validation produces a plurality of predictions for correspondingexamples in the training data; and for one or more of the plurality ofpredictions each being for a corresponding example, applying the weightassociated with the example's answer category to the weighted accuracyfor the predictive model. The prediction is correct or incorrect. Eachweight further associated with a prediction, and wherein calculating theweighted accuracy for a particular predictive model comprises:performing a plurality of rounds of cross-validation of the predictivemodel using the training data wherein each round of cross-validationproduces a plurality of predictions for corresponding examples in thetraining data; and for one or more of the plurality of predictions eachbeing for a corresponding example, applying the weight associated withthe prediction and the example's answer category to the weightedaccuracy for the predictive model. Obtaining the training data furthercomprises determining the weights based at least partly on the trainingdata. The weights are determined based on a distribution of answercategories in the training data. A particular predictive model is aNaive Bayes classifier, a k-nearest neighbor classifier, a supportvector machine, or a predictive model that uses a logistic regressiontechnique.

Particular embodiments of the subject matter described in thisspecification can be implemented so as to realize one or more of thefollowing advantages. Users can specify one or more utilities (or“weights”) that identify the relative utilities of one or morecategories in a data set, or each range of values for real-valued datasets. (Weights can also be determined automatically.) For example, if auser specifies a single weight for a category the weight can representthe value of reducing false positives or false negatives for thatcategory. If two weights are specified for a category, the weights canrepresent the value of reducing both false positives and false negativesfor the category. Users only need to specify those categories/valueswhose weights differ from a default value. The weights can be storedwith a model and reused when the model is retrained or updated with newdata. The weights can also be used to tune the model when the modelmakes a training error, where those errors with higher weight change themodel more significantly during training. The weights can also be usedto calculate a weighted accuracy of predictive models or determine amaximum expected utility for model predictions.

The details of one or more embodiments of the subject matter describedin this specification are set forth in the accompanying drawings and thedescription below. Other features, aspects, and advantages of thesubject matter will become apparent from the description, the drawings,and the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an example predictive model system.

FIG. 2 is a flowchart of an example process for determining the weightedaccuracy of a set of predictive models.

FIG. 3 is a flowchart of an example process 300 for applying amaximizing expected utility to the output of a probabilistic model.

FIG. 4 is a flowchart of an example process for using weights duringmodel training.

Like reference numbers and designations in the various drawings indicatelike elements.

DETAILED DESCRIPTION

In various implementations, a predictive model is either a categoricalmodel if its predictions are categories, or is a regression model if itspredictions are numeric. A predictive model is trained using trainingdata. Training data encompasses examples that each comprise one or moredata fields (or “features”) plus an answer (a category or a numericvalue) for that example. By way of illustration, the training data inTABLE 1 consists of examples that are email message subject lines and acategory that indicates whether each example represents SPAM or not.

TABLE 1 EMAIL SUBJECT LINE ANSWER “You have won $$$” “spam” “Lose weightfast!” “spam” “Lowest interest rates ever!” “spam” “How are you?” “notspam” “Trip to New York” “not spam”

After a model has been trained against training data, queries can besubmitted to the model. In some implementations, queries are similar inform to training examples: that is, a query has the same or fewer datafields but does not include the answer. The trained model uses patternsthat it learned from the training data to either find the closestcategory for the submitted query (if it is a categorical model) orestimate a value for the query (if it is a regression model), andoutputs the category or value. In some implementations, a categoricalmodel is a probabilistic model and outputs a set of results, with oneresult for each category in the training data, along with a scoreassigned to that category. Score values range from 0.0-1.0, for example,with 1.0 being the highest. In some implementations, the largest, mostpositive score is the most likely category predicted for the giveninput. For example, if the training data categories are A, B and C, anexample output from a categorical model would be a set of results suchas {A=0.4, B=0.5, C=0.1}, where the score of category A is 0.5, thescore of category B is 0.5, and the score of category C is 0.1. NaiveBayes models, maximum entropy models, and support vector machines, forinstance, can be used as probabilistic models. Non-probabilistic modelscan be made to be probabilistic using well-known techniques.

Classifier Evaluation

FIG. 1 illustrates an example predictive modeling system 100. The system100 includes one or more client computing devices (clients 102, 104 and106) that can communicate through one or more networks 106 (e.g., theInternet) with a collection of remote server computing devices (or“servers”), such as servers deployed in a data center 108 or indifferent geographic locations. Users 102 a, 104 a, and 106 a caninteract with the system 100 using web browsers or other computersoftware that executes on the clients.

A given server comprises one or more data processing apparatus. Theservers can communicate with each other and with storage systems (e.g.,model training data storage system 114 and weight storage system 116) atvarious times using one or more computer networks or other communicationmeans. For example, the servers in the data center 108 can be coupled toan intranet. A computer program can execute on a single server or,alternatively, the program can be organized into components that executeon multiple servers. There can be more than one instance or copy of agiven computer program executing on the collection of servers at anygiven time. Multiple copies of a computer program that implements amodel implementation, for instance, can be executing at the same time onone or more servers.

Computer programs can be executed in parallel by the servers. Forexample, two computer programs are executed in parallel if they areexecuted on different servers and if at least a portion of theirexecution occurs at the same time. By way of illustration, assume thatcomputer program A is executed on server S1 and computer program B isexecuted on server S2. If some period of time exists where program A andB are both being executed, then the programs are executed in parallel.

The servers execute computer programs that implement predictive models120, a model trainer 118, a model evaluator 110, and an optional weightdetermining process 112. (The weight determining process 112 isdiscussed further below.) A model implementation is one or more computerprograms that execute on one or more servers. For example, the modelimplementation can be a computer program that is designed to execute ona single server or it can be designed to execute on multiple servers. Anexample of the later approach is a model implemented as a map-reducesystem. A map-reduce system includes application-independent map modulesconfigured to read input data and to apply at least oneapplication-specific map operation to the input data to produceintermediate data values. The map operation is automaticallyparallelized across multiple servers. Intermediate data structures areused to store the intermediate data values. Application-independentreduce modules are configured to retrieve the intermediate data valuesand to apply at least one application-specific reduce operation to theintermediate data values to provide output data. The map-reduce systemis described further in U.S. Pat. No. 7,650,331, entitled “System andmethod for efficient large-scale data processing,” which is incorporatedby reference herein in its entirety.

A given model (e.g., a support vector machine) can have a number ofdifferent possible model implementations. For example, there can besmall, medium and large implementations. By way of illustration, a smallimplementation can use the computing resources of a single server, amedium implementation can have a parallelized implementation (e.g., amap-reduce implementation) that uses the resources of N servers, and alarge implementation can have a parallelized implementation that usesthe resources of P servers, where P>N.

The weight storage system 116 stores one or more weights to be used todetermine a weighted accuracy for a set of models that have been trainedwith the same training data. In further implementations, the weights canbe used to tune the models as they are being trained. (Model tuning isdescribed further below.) The model trainer 118 can train differenttypes of predictive models using the training data stored in thetraining data system 114. Each of the trained predictive modelsimplements a different machine learning technique (e.g., Naive Bayesclassifier, a k-nearest neighbor classifier, a support vector machine,or a predictive model that uses a logistic regression technique). Themodel evaluator 110 calculates a weighted accuracy for each of thepredictive models using the weights.

In some implementations, the model evaluator 110 performs one or morerounds of cross-validation of each predictive model using the trainingdata wherein each round of cross-validation produces a plurality ofpredictions for corresponding examples in the training data. Validationcan be performed using K-fold validation, k×2 cross-validation, orrandom sub-sampling validation, for example. Other validation techniquesare possible. Depending on the specified weights, some predictions countmore towards the accuracy of a given model than others. (Calculation ofweighted accuracy is discussed further below.) The model evaluator 110selects one or more of the predictive models as the most accurate modelsbased on the calculated weighted accuracies. In some implementations,the predictive models having the highest weighted accuracy scores areselected. The weighted accuracies of different models can be calculatedin parallel.

The weights can be specified by a user (e.g., user 104 a) or can bedetermined automatically by the weight determining process 112. A givenweight is associated with an answer category. If the model is acategorical model, an answer category is a label that corresponds to atype of answer in the training data (e.g., “spam”, “not spam”). If themodel is a regression model, the answer category is a set of one or morevalues (or a range of values) that correspond to answers in the trainingdata (e.g., 0.8 through 0.9, 2.4, 3.34). In various implementations, aweight can be specified as a tuple: <A, P, W>, where A is the categoryof an example's answer, P is a model's prediction for the example, and Wis a weight to apply.

Weights can be viewed as being for false positive predictions or falsenegative predictions. In the email example above, the weights can bespecified so that a false negative prediction is worth 10,000 times morethan a false positive prediction:

<“spam”, “not spam”, 10000>

<“not spam”, “spam”, 1>.

Weights can be specified for a variety of input/prediction combinations.This can be visualized as a matrix with predictions forming the verticalaxis, answer categories of input examples forming the horizontal axis,and the diagonal of the matrix representing correct predictions. Forexample, if there are three answer categories A, B and C, the matrixcould be as follows:

TABLE 2 A B C A 100  1 50 B 1 100  50 C 1 1 100 

The nine weights for the above matrix would be:

<A, A, 100>

<A, B, 1>

<A, C, 50>

<B, A, 1>

<B, B, 100>

<B, C, 50>

<C, A, 1>

<C, B, 1>

<C, C, 100>.

In this example, correct predictions in any answer category are weightedas 100 whereas incorrect predictions are weighted as 1 or 50 dependingon the combination of prediction and example answer category.

In various implementations, the weighted accuracy WA can be computed

$\begin{matrix}{{{WA}(M)} = \frac{\sum\limits_{i = 0}^{n}{{{IsCorrect}\left( {{Mp}\left( x_{i} \right)} \right)} \times {w\left( {{{answer}\left( x_{i} \right)},{{Mp}\left( x_{i} \right)}} \right)}}}{{\sum\limits_{i = 0}^{n}1} + \left( {{{IsCorrect}\left( {{Mp}\left( x_{i} \right)} \right)} \times {w\left( {{{answer}\left( x_{i} \right)},{{Mp}\left( x_{i} \right)}} \right)}} \right)}} & (1)\end{matrix}$

where M is the model, n is the number of training examples beingvalidated, x_(i) is an instance of a training example in the trainingdata for M, Mp(x_(i)) is a prediction by M for the training examplex_(i), IsCorrect(Mp(x_(i))) is equal to 1 if the prediction is correct(i.e., if the prediction matches x_(i)'s correct answer) and 0 if theprediction is incorrect, answer(x_(i)) is equal to x_(i)'s answer, andw(a, b) is equal to the weight w for a tuple specified by <a, b, w> or 0if there is not a matching tuple. For example, a given a weight of <“notspam”, “not spam”, 10000>, the numerator and denominator of the WA areboth increased by 10,000 each time a model M correctly predicts that anemail message is “not spam”.

FIG. 2 is a flowchart of an example process 200 for determining theweighted accuracy of a set of predictive models. Training data isobtained from, for example, the training data storage system 114 (step202). The training data comprises a plurality of examples. Each exampleincludes one or more features and an answer. Different types ofpredictive models are trained using the obtained training data (step204). The training can be performed by multiple instances of the modeltrainer 118, for example. One or more weights are obtained (e.g., fromthe weight storage system 116; step 206). The weights are used tocalculate a weighted accuracy WA for each model (step 208). Calculatingthe weighted accuracy can be performed by the model evaluator 110. Themodel having the most accurate weighted accuracy WA is selected (step210) as the best model to use for the given training data. If there is atie between two or more models, then a model can be selected based onother factors besides weighted accuracy such as, for example, the sizeof the models or the execution speeds of the models.

An application programming interface (API) can be utilized by softwareexecuting on clients 102, 104 and 106 to programmatically specifyweights for a given training data. In some implementations, the API isimplemented in the Hypertext Transfer Protocol (HTTP). Other APIs arepossible. Using the API, weights can be specified using the HTTP POSTmethod. The following message specifies a single weight for answercategory “category X”:

POST

https://www.googleapis.com/prediction/training?key=api_key

{

-   -   “id”: “training_bucket/training_data”,    -   “weights”: {“category X”: 10}    -   . . .

}

The following message specifies two weights for answer category“category X”, the first weight being for a correct prediction and thesecond weight being for an incorrect prediction:

POST

https://www.googleapis.com/prediction/training?key=api_key

{

-   -   “id”: “training_bucket/training_data”,    -   “weights”: {“category X”: 10, 5}    -   . . .

}

Another message type can be used to calculated the weighted accuracy ofa model based on weights specified in the message:

POST

{

-   -   “kind”: “prediction#training”,    -   “id”: “training_bucket/training_data”,    -   “selfLink”: “https://www.apis.com/prediction/URL_of_resource,    -   “modelInfo”: {        -   “modelType”: “categoryification”,        -   “categoryificationAccuracy”: 0.XX,        -   “weights”: {“category X”: 10, “category Y”: 4, . . . },    -   “trainingStatus”:status

}

Other API messages are possible.

The weight determining process 112 can determine weights automaticallyfrom training data. For example, weights can be derived based on thedistribution of answer categories in the training set. By way ofillustration, if a training dataset has 5 examples of category A, 10examples of category B, and 1 example of category C, the weightdetermining process 112 can specify even performance on all categoriesby creating tuples that weight correction predictions of C as 10, B as 1and A as 2. Another approach is to take the logarithm of the number ofcategory examples where the weight of category A would be log(5), Bwould be log(10)=1, and C would be log(1)=0. Other ways of automaticallydetermining weights are possible.

In some implementations, the weight determining process 112 candetermine weights with guidance from user-specified heuristics. Suchheuristics can direct the weight determining process 112 to value smallanswer categories over large ones, specify the value of answercategories (e.g., high, medium, and low), value categories that have aninstance count below a certain threshold, and so on.

Maximum Expected Utility Classification

Making a statistically optimal decision does not require that a modelknow about the costs, simply that it produce good probabilities.Consequently, any probabilistic model can be used to maximize utility;those that produce better probabilities should produce better results. Atypical decision function for classifiers is to choose the category withmaximum probability. In various implementations, however, the categorythat maximizes expected utility is determined by the following:δ(x)=max_(d)Σ_(y) p(y|x)U(y,d)  (2)where x is a training example instance, p is the probability of categoryy given x, d are the possible decision labels, y are the possiblecategories, and U is the utility function.

For example, if an instance x is a type of mushroom and the possiblecategories y are “poisonous” and “nonpoisonous”, the utility function Uis a decision whether to “eat” or “do not eat” the mushroom of instancex. Whether or not the mushroom is poisonous becomes irrelevant if one ison the brink of starvation. That is, if one was starving (e.g., d=“eat”)one would choose to eat the mushroom even if the probability of themushroom being poisonous was greater than zero. In such a case, theutility function U would cause the nonpoisonous category to have ahigher probability than the poisonous category. This means that categoryresults are re-ranked during prediction rather than training so thatcategories/output regions for regression that are more favored in termsof utility receive “extra points” and are weighted differently atprediction time.

In various implementations, the utility function U can providing amapping between a prediction p(y|x) and a decision label d. Each mappingcan be specified as a tuple: <y, d, m> where y specifies a predictioncategory, d specifies a decision label, and m specifies a mapping forp(y|x). For example, m could specify that p(y|x) is multiplied by two.

For example, assuming that:p(y|x)={A:0.5,B:0.3,C:0.2},

where category A has a probability of 0.5, category B has a probabilityof 0.3, category C has a probability of 0.2, and the utility function Uweights category C twice that of category B or category A, then:

${{{p\left( y \middle| x \right)}{U\left( {y,d} \right)}} = \left\{ {{A\text{:}\mspace{14mu} 0.42\mspace{14mu}{or}\mspace{14mu}\frac{5}{12}},{B\text{:}\mspace{14mu} 0.25\mspace{14mu}{or}\mspace{14mu}\frac{3}{12}},{C\text{:}\mspace{14mu} 0.33\mspace{14mu}{or}\mspace{14mu}\frac{2}{12}}} \right\}},$

where 12 is the sum of the probabilities of A, B and 2×C. Therefore,δ(x)=A.

FIG. 3 is a flowchart of an example process 300 for applying amaximizing expected utility to the output of a probabilistic model. Aprobabilistic model M is first trained (step 302). The training can beperformed by the model trainer 118 using training data in the trainingdata storage system 114, for example. A utility function U is thenobtained (step 304). The utility function can be specified as mappingtuples, as described above. A set of training example instances isobtained (step 306) and a prediction is generated for each using themodel M (step 308). The predictions can be generated using the modelevaluator 110 or another computer program, for instance. One or more ofthe generated predictions are then modified by applying formula (2)above to determine the maximum expected utility for the predictions(step 310).

Error Correction

In further implementations, user-specified or automatically determinedtraining weights can be provided to machine learning algorithms that areconfigured to use them during training. For example, a model that istrained using the winnow algorithm (or another algorithm such as, forinstance, Naive Bayes) can use the provided training weights to alterits own prediction coefficients to learn a classifier for the model.

When a classifier makes a prediction error, the learning algorithm canuse the provided weights to adjust its prediction rule and therebycorrect for the error. By way of illustration, if it is important thatthe classifier predict category A correctly, the learning algorithm canbe altered when the classifier incorrectly predicts category A so thatit changes more significantly than when the classifier incorrectlypredicts other categories. Non-probabilistic models that do not supportcost-sensitive learning can be converted to probabilistic classifiers byfitting a sigmoid function to their output and using them as describedabove. A sigmoid function can be used to model the output of eachpossible category. The shape of the sigmoid curve can incorporate theweights of each category, biasing towards those that are more valuableand away from those that are less so. The sum of all the sigmoidfunctions for each example should be equal to 1. Then, the calculatedvalue of each sigmoid function is considered as the probability of thecorresponding class.

By way of example, the winnow machine learning algorithm uses thefollowing rule for prediction:

$\begin{matrix}{p = {\sum\limits_{i = 1}^{n}{w_{i}f_{i}}}} & (3)\end{matrix}$

where w_(i) is a coefficient for i ε{1 . . . n} and the trainingexamples each comprises the features f₁, . . . f_(n). If p>Θ then theprediction is equal to 1, otherwise the prediction is equal to 0. Thethreshold Θ is a real number (e.g.,

$\left( {{e.g.},{\Theta = \frac{n}{2}}} \right).$The update rule an winnow is generally as follows. If an example iscorrectly classified, do nothing. If an example is predicted to be 1 butthe correct result was 0, all of the coefficients involved in themistake are set to zero. If an example is predicted to be 0 but thecorrect result was 1, all of the coefficients involved in the mistakeare multiplied by α (e.g., α=2). In various implementations, α can beset to, or adjusted by, a training weight provided by a weight tuple:<A, P, W>, where A is the category of an example's correct answer, P isthe model's prediction for the example, and W is a weight to apply to α.A weight W can be used to linearly shift the coefficients, for example.Other ways of specifying weights are possible.

FIG. 4 is a flowchart of an example process 400 for using weights duringmodel training A training example is obtained, such as an example thathas the features f₁, . . . f_(n) (step 402). A machine learningalgorithm's prediction rule is then applied to the training example togenerate a prediction (step 404). If the prediction is correct (step406), it is determined whether there are more training examples (step412). If so, the process continues at step 402 where another trainingexample is obtained. If there are no further training examples (step412), the training is completed.

If the prediction is incorrect (step 406), one or more coefficients ofthe prediction rule are modified (step 408) by α. The value of thecoefficients can be equal to, or adjusted by, one or more providedtraining weights (step 410). The process continues at step (412) where,if there are more training examples, the process continues at step 402where another training example is obtained. Otherwise, the processterminates.

Embodiments of the subject matter and the operations described in thisspecification can be implemented in digital electronic circuitry, or incomputer software, firmware, or hardware, including the structuresdisclosed in this specification and their structural equivalents, or incombinations of one or more of them. Embodiments of the subject matterdescribed in this specification can be implemented as one or morecomputer programs, i.e., one or more modules of computer programinstructions, encoded on computer storage medium for execution by, or tocontrol the operation of, data processing apparatus. Alternatively or inaddition, the program instructions can be encoded on anartificially-generated propagated signal, e.g., a machine-generatedelectrical, optical, or electromagnetic signal, that is generated toencode information for transmission to suitable receiver apparatus forexecution by a data processing apparatus. A computer storage medium canbe, or be included in, a computer-readable storage device, acomputer-readable storage substrate, a random or serial access memoryarray or device, or a combination of one or more of them. Moreover,while a computer storage medium is not a propagated signal, a computerstorage medium can be a source or destination of computer programinstructions encoded in an artificially-generated propagated signal. Thecomputer storage medium can also be, or be included in, one or moreseparate physical components or media (e.g., multiple CDs, disks, orother storage devices).

The operations described in this specification can be implemented asoperations performed by a data processing apparatus on data stored onone or more computer-readable storage devices or received from othersources.

The term “data processing apparatus” encompasses all kinds of apparatus,devices, and machines for processing data, including by way of example aprogrammable processor, a computer, a system on a chip, or multipleones, or combinations, of the foregoing The apparatus can includespecial purpose logic circuitry, e.g., an FPGA (field programmable gatearray) or an ASIC (application-specific integrated circuit). Theapparatus can also include, in addition to hardware, code that createsan execution environment for the computer program in question, e.g.,code that constitutes processor firmware, a protocol stack, a databasemanagement system, an operating system, a cross-platform runtimeenvironment, a virtual machine, or a combination of one or more of them.The apparatus and execution environment can realize various differentcomputing model infrastructures, such as web services, distributedcomputing and grid computing infrastructures.

A computer program (also known as a program, software, softwareapplication, script, or code) can be written in any form of programminglanguage, including compiled or interpreted languages, declarative orprocedural languages, and it can be deployed in any form, including as astand-alone program or as a module, component, subroutine, object, orother unit suitable for use in a computing environment. A computerprogram may, but need not, correspond to a file in a file system. Aprogram can be stored in a portion of a file that holds other programsor data (e.g., one or more scripts stored in a markup languageresource), in a single file dedicated to the program in question, or inmultiple coordinated files (e.g., files that store one or more modules,sub-programs, or portions of code). A computer program can be deployedto be executed on one computer or on multiple computers that are locatedat one site or distributed across multiple sites and interconnected by acommunication network.

A system of one or more computers can be configured to performparticular operations or actions by virtue of having software, firmware,hardware, or a combination of them installed on the system that inoperation causes or cause the system to perform the actions. One or morecomputer programs can be configured to perform particular operations oractions by virtue of including instructions that, when executed by dataprocessing apparatus, cause the apparatus to perform the actions.

The processes and logic flows described in this specification can beperformed by one or more programmable processors executing one or morecomputer programs to perform actions by operating on input data andgenerating output. The processes and logic flows can also be performedby, and apparatus can also be implemented as, special purpose logiccircuitry, e.g., an FPGA (field programmable gate array) or an ASIC(application-specific integrated circuit).

Processors suitable for the execution of a computer program include, byway of example, both general and special purpose microprocessors, andany one or more processors of any kind of digital computer. Generally, aprocessor will receive instructions and data from a read-only memory ora random access memory or both. The essential elements of a computer area processor for performing actions in accordance with instructions andone or more memory devices for storing instructions and data. Generally,a computer will also include, or be operatively coupled to receive datafrom or transfer data to, or both, one or more mass storage devices forstoring data, e.g., magnetic, magneto-optical disks, or optical disks.However, a computer need not have such devices. Moreover, a computer canbe embedded in another device, e.g., a mobile telephone, a personaldigital assistant (PDA), a mobile audio or video player, a game console,a Global Positioning System (GPS) receiver, or a portable storage device(e.g., a universal serial bus (USB) flash drive), to name just a few.Devices suitable for storing computer program instructions and datainclude all forms of non-volatile memory, media and memory devices,including by way of example semiconductor memory devices, e.g., EPROM,EEPROM, and flash memory devices; magnetic disks, e.g., internal harddisks or removable disks; magneto-optical disks; and CD-ROM and DVD-ROMdisks. The processor and the memory can be supplemented by, orincorporated in, special purpose logic circuitry.

To provide for interaction with a user, embodiments of the subjectmatter described in this specification can be implemented on a computerhaving a display device, e.g., a CRT (cathode ray tube) or LCD (liquidcrystal display) monitor, for displaying information to the user and akeyboard and a pointing device, e.g., a mouse or a trackball, by whichthe user can provide input to the computer. Other kinds of devices canbe used to provide for interaction with a user as well; for example,feedback provided to the user can be any form of sensory feedback, e.g.,visual feedback, auditory feedback, or tactile feedback; and input fromthe user can be received in any form, including acoustic, speech, ortactile input. In addition, a computer can interact with a user bysending resources to and receiving resources from a device that is usedby the user; for example, by sending web pages to a web browser on auser's client device in response to requests received from the webbrowser.

Embodiments of the subject matter described in this specification can beimplemented in a computing system that includes a back-end component,e.g., as a data server, or that includes a middleware component, e.g.,an application server, or that includes a front-end component, e.g., aclient computer having a graphical user interface or a Web browserthrough which a user can interact with an implementation of the subjectmatter described in this specification, or any combination of one ormore such back-end, middleware, or front-end components. The componentsof the system can be interconnected by any form or medium of digitaldata communication, e.g., a communication network. Examples ofcommunication networks include a local area network (“LAN”) and a widearea network (“WAN”), an inter-network (e.g., the Internet), andpeer-to-peer networks (e.g., ad hoc peer-to-peer networks).

The computing system can include clients and servers. A client andserver are generally remote from each other and typically interactthrough a communication network. The relationship of client and serverarises by virtue of computer programs running on the respectivecomputers and having a client-server relationship to each other. In someembodiments, a server transmits data (e.g., an HTML page) to a clientdevice (e.g., for purposes of displaying data to and receiving userinput from a user interacting with the client device). Data generated atthe client device (e.g., a result of the user interaction) can bereceived from the client device at the server.

While this specification contains many specific implementation details,these should not be construed as limitations on the scope of anyinventions or of what may be claimed, but rather as descriptions offeatures specific to particular embodiments of particular inventions.Certain features that are described in this specification in the contextof separate embodiments can also be implemented in combination in asingle embodiment. Conversely, various features that are described inthe context of a single embodiment can also be implemented in multipleembodiments separately or in any suitable subcombination. Moreover,although features may be described above as acting in certaincombinations and even initially claimed as such, one or more featuresfrom a claimed combination can in some cases be excised from thecombination, and the claimed combination may be directed to asubcombination or variation of a subcombination.

Similarly, while operations are depicted in the drawings in a particularorder, this should not be understood as requiring that such operationsbe performed in the particular order shown or in sequential order, orthat all illustrated operations be performed, to achieve desirableresults. In certain circumstances, multitasking and parallel processingmay be advantageous. Moreover, the separation of various systemcomponents in the embodiments described above should not be understoodas requiring such separation in all embodiments, and it should beunderstood that the described program components and systems cangenerally be integrated together in a single software product orpackaged into multiple software products.

Thus, particular embodiments of the subject matter have been described.Other embodiments are within the scope of the following claims. In somecases, the actions recited in the claims can be performed in a differentorder and still achieve desirable results. In addition, the processesdepicted in the accompanying figures do not necessarily require theparticular order shown, or sequential order, to achieve desirableresults. In certain implementations, multitasking and parallelprocessing may be advantageous.

What is claimed is:
 1. A computer-implemented method, the methodcomprising: obtaining training data comprising a plurality of exampleswherein each example comprises one or more features and an answer;training a plurality of different types of predictive models using thetraining data, wherein each of the predictive models implements adifferent machine learning technique; obtaining weights wherein eachweight is associated with a respective answer category in the pluralityof examples, each of the weights indicating an amount the respectiveanswer category will count toward a weighted accuracy for each of thepredictive models; calculating the weighted accuracy for each of thepredictive models using the respective weights; and selecting one of thepredictive models as the most accurate model based at least partly onthe calculated weighted accuracies.
 2. The method of claim 1 wherein aplurality of the weighted accuracies are calculated in parallel.
 3. Themethod of claim 1 wherein a particular answer category is a label, anumeric value, a range of numeric values, or a set of numeric values. 4.The method of claim 1 wherein calculating the weighted accuracy for aparticular predictive model comprises: performing a plurality of roundsof cross-validation of the predictive model using the training datawherein each round of cross-validation produces a plurality ofpredictions for corresponding examples in the training data; and for oneor more of the plurality of predictions each being for a correspondingexample, applying the weight associated with the example's answercategory to the weighted accuracy for the predictive model.
 5. Themethod of claim 4 wherein the prediction is correct.
 6. The method ofclaim 4 wherein the prediction is incorrect.
 7. The method of claim 1wherein each weight further associated with a prediction, and whereincalculating the weighted accuracy for a particular predictive modelcomprises: performing a plurality of rounds of cross-validation of thepredictive model using the training data wherein each round ofcross-validation produces a plurality of predictions for correspondingexamples in the training data; and for one or more of the plurality ofpredictions each being for a corresponding example, applying the weightassociated with the prediction and the example's answer category to theweighted accuracy for the predictive model.
 8. The method of claim 1wherein obtaining the training data further comprises determining theweights based at least partly on the training data.
 9. The method ofclaim 8 wherein the weights are determined based on a distribution ofanswer categories in the training data.
 10. The method of claim 1wherein a particular predictive model is a Naive Bayes classifier, ak-nearest neighbor classifier, a support vector machine, or a predictivemodel that uses a logistic regression technique.
 11. A systemcomprising: data processing apparatus configured to execute instructionswhich cause the data processing apparatus to perform operationscomprising: obtaining training data comprising a plurality of exampleswherein each example comprises one or more features and an answer;training a plurality of different types of predictive models using thetraining data, wherein each of the predictive models implements adifferent machine learning technique; obtaining weights wherein eachweight is associated with a respective answer category in the pluralityof examples, each of the weights indicating an amount the respectiveanswer category will count toward a weighted accuracy for each of thepredictive models; calculating the weighted accuracy for each of thepredictive models using the respective weights; and selecting one of thepredictive models as the most accurate model based at least partly onthe calculated weighted accuracies.
 12. The system of claim 11 wherein aplurality of the weighted accuracies are calculated in parallel.
 13. Thesystem of claim 11 wherein a particular answer category is a label, anumeric value, a range of numeric values, or a set of numeric values.14. The system of claim 11 wherein calculating the weighted accuracy fora particular predictive model comprises: performing a plurality ofrounds of cross-validation of the predictive model using the trainingdata wherein each round of cross-validation produces a plurality ofpredictions for corresponding examples in the training data; and for oneor more of the plurality of predictions each being for a correspondingexample, applying the weight associated with the example's answercategory to the weighted accuracy for the predictive model.
 15. Thesystem of claim 14 wherein the prediction is correct.
 16. The system ofclaim 14 wherein the prediction is incorrect.
 17. The system of claim 11wherein each weight further associated with a prediction, and whereincalculating the weighted accuracy for a particular predictive modelcomprises: performing a plurality of rounds of cross-validation of thepredictive model using the training data wherein each round ofcross-validation produces a plurality of predictions for correspondingexamples in the training data; and for one or more of the plurality ofpredictions each being for a corresponding example, applying the weightassociated with the prediction and the example's answer category to theweighted accuracy for the predictive model.
 18. The system of claim 11wherein obtaining the training data further comprises determining theweights based at least partly on the training data.
 19. The system ofclaim 18 wherein the weights are determined based on a distribution ofanswer categories in the training data.
 20. The system of claim 11wherein a particular predictive model is a Naive Bayes classifier, ak-nearest neighbor classifier, a support vector machine, or a predictivemodel that uses a logistic regression technique.
 21. A storage mediumhaving instructions stored thereon that, when executed by dataprocessing apparatus, cause the data processing apparatus to performoperations comprising: obtaining training data comprising a plurality ofexamples wherein each example comprises one or more features and ananswer; training a plurality of different types of predictive modelsusing the training data, wherein each of the predictive modelsimplements a different machine learning technique; obtaining weightswherein each weight is associated with a respective answer category inthe plurality of examples, each of the weights indicating an amount therespective answer category will count toward a weighted accuracy foreach of the predictive models; calculating the weighted accuracy foreach of the predictive models using the respective weights; andselecting one of the predictive models as the most accurate model basedat least partly on the calculated weighted accuracies.
 22. The storagemedium of claim 21 wherein a plurality of the weighted accuracies arecalculated in parallel.
 23. The storage medium of claim 21 wherein aparticular answer category is a label, a numeric value, a range ofnumeric values, or a set of numeric values.
 24. The storage medium ofclaim 21 wherein calculating the weighted accuracy for a particularpredictive model comprises: performing a plurality of rounds ofcross-validation of the predictive model using the training data whereineach round of cross-validation produces a plurality of predictions forcorresponding examples in the training data; and for one or more of theplurality of predictions each being for a corresponding example,applying the weight associated with the example's answer category to theweighted accuracy for the predictive model.
 25. The storage medium ofclaim 24 wherein the prediction is correct.
 26. The storage medium ofclaim 24 wherein the prediction is incorrect.
 27. The storage medium ofclaim 21 wherein each weight further associated with a prediction, andwherein calculating the weighted accuracy for a particular predictivemodel comprises: performing a plurality of rounds of cross-validation ofthe predictive model using the training data wherein each round ofcross-validation produces a plurality of predictions for correspondingexamples in the training data; and for one or more of the plurality ofpredictions each being for a corresponding example, applying the weightassociated with the prediction and the example's answer category to theweighted accuracy for the predictive model.
 28. The storage medium ofclaim 21 wherein obtaining the training data further comprisesdetermining the weights based at least partly on the training data. 29.The storage medium of claim 28 wherein the weights are determined basedon a distribution of answer categories in the training data.
 30. Thestorage medium of claim 21 wherein a particular predictive model is aNaive Bayes classifier, a k-nearest neighbor classifier, a supportvector machine, or a predictive model that uses a logistic regressiontechnique.